<template>
  <div>
    <div v-for="(item,index) in arr" 
      :key="index"
      style="display: inline-block;">
        <input type="checkbox" :value="item"  v-model.number="newArr">
        <span>{{item}}</span>
    </div>
    <div>
      <h3>你选中的元素总和为:{{getSum}}</h3>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return {
     newArr:[],
     arr:[9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87]
    }
  },
  computed:{
    getSum(){
        return this.newArr.reduce((sum,item) => sum += item,0)
    }
  }
}
</script>

<style>

</style>